package com.jcc.springcloud.controller;

import com.jcc.springcloud.result.CommonResult;
import com.jcc.springcloud.service.RegisterService;
import com.jcc.springcloud.user.UserDo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class RegisterController {
    @Resource
    private RegisterService registerService;

    @ResponseBody
    @PostMapping(value = "/register")
    public CommonResult create(@RequestBody UserDo userDo){
        int result = registerService.register(userDo);
        log.info("************注册结果："+result);
        if(result > 0)
        {
            return new CommonResult(200,"注册成功",null);
        }else{
            return new CommonResult(444,"注册失败",null);
        }
    }
}
